# example.pyx
cdef extern from "example.cpp":
    pass

cdef class PyExample:
    cdef Example * thisptr  # Holds a C++ instance pointer

    def __cinit__(self):
        self.thisptr = new Example()

    def __dealloc__(self):
        del self.thisptr

    def greet(self):
        self.thisptr.greet()